package TowDer.TowerEnemys;

import java.util.ArrayList;

import javax.swing.JLabel;

import TowDef.generic.Enemy;
import TowDef.generic.Map;

public class MoveWave  extends Thread{
	Map map;
	ArrayList<JLabel> imgs;
	ArrayList<Enemy> enemys;
	
	
	public MoveWave(ArrayList<Enemy> enemy, ArrayList<JLabel> img, Map map)
	{
		this.map = map;
		this.imgs = img;
		this.enemys = enemy;
	}
	@SuppressWarnings("deprecation")
	public void run(){
		int contador = 0;
		int j = 0;
		while(enemys.get(0)!=null){
			
		if(enemys.get(j).getLife()>0&&imgs.get(j).getX()<200){
			imgs.get(j).setBounds(imgs.get(j).getX()+2,imgs.get(j).getY(),30,30);
			contador++;
			try {
				Thread.sleep(30);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			if(contador <10){
				contador = 0;
				enemys.get(j).move();
			}
		}
		if(j==enemys.size()-1)
			j=0;
		else
			j++;
	}
	}
}
